package org.kgc.alanhealth.controller;

import org.kgc.alanhealth.entity.HospitalType;
import org.kgc.alanhealth.service.HospitalTypeService;
import org.kgc.alanhealth.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@CrossOrigin(origins = "*")
public class HospitalTypeController {

    @Autowired
    private HospitalTypeService hospitalTypeService;

    @GetMapping("hospital-type")       ///马俊康
    public Result getTypesByDepartmentId(int id){
        List<HospitalType> list=hospitalTypeService.getTypesByDepartmentId(id);
        if (list!=null&&!list.isEmpty()){
            return Result.success(list);
        }else {
            return Result.error("没有找到数据");
        }
    }
}